// BouncingBallPlantController // System macro g = -9.81; macro restCoef = 0.5; macro y0 = 10; module BouncingBallPlant(event real ?initialPosition, hybrid real position, hybrid real velocity) { position = initialPosition; while (true) { flow { drv(position) <- cont(velocity); drv(velocity) <- g; } until(cont(position) <= 0 and cont(velocity) < 0); next(velocity) = -velocity * restCoef; flow {} until (true); } } drivenby { //initial position initialPosition = y0; // running for(i=0..250) pause; }